-
Notifications
You must be signed in to change notification settings - Fork 99
Add statically typed color representation #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
docs/2_3_range-plots.fsx
Outdated
@@ -52,8 +52,8 @@ let range1 = | |||
Chart.Range( | |||
x,y,yUpper,yLower, | |||
StyleParam.Mode.Lines_Markers, | |||
Color="grey", | |||
RangeColor="lightblue") | |||
Color = Color.ColorString "grey", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be called Color.fromString
for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. Thanks for the hint.
docs/1_3_shapes.fsx
Outdated
@@ -47,8 +47,8 @@ multiple shapes at once. | |||
|
|||
open Plotly.NET.LayoutObjects | |||
|
|||
let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3") | |||
let s2 = Shape.init (StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3") | |||
let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor= Color.fromWebColor "#d3d3d3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave out the distinction between "webcolor" and hex and merge them, adding a check if the string starts with a #
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. It is actually the same. I removed fromHex...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not being clear, but I would rather name both fromHex
, this would be the naming web devs would expect when creating colors from hex strings. The name fromWebColor
implies that things such as "grey"
or "aquamarine"
should work as well. So fromWebColor
should either accept both hex and standard web color strings, or be renamed to fromHex
This PR adds support to statically typed color representation. Warning: Introduces breaking changes.
However, you still can use Colors from Plotly string by Color.ColorString "red"
Fixes #138
Fixes #124